var _pInfo = {
	"userInfo": null,
	"param": getQueryParams(),
	"renderData": function() {
		AjaxRequest({
			url: _url + "/money/user/usermsg",
			type: "post",
			load: true,
			data: {
				"userid": _pInfo.userInfo["id"]
			},
			success: function(rs) {
				if(isReqSucceed(rs)) {
					$("#personal-body").html(template("personal-body-tpl", {
						rs: rs.data,
						url: imgUrl
					}));
				}
			}
		});
	},
	"doUserAuth": function() {
		var _data = {
			"userid": _pInfo.userInfo["id"]
		}
		var realname = $("#realname").val().trim();
		var idnumber = $("#idnumber").val().trim();
		var _idcardReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
		if(isNull(realname)) {
			$.toast("真实姓名不能为空", "text");
			return;
		}
		if(isNull(idnumber)) {
			$.toast("身份证号不能为空", "text");
			return;
		}
		if(!_idcardReg.test(idnumber)) {
			$.toast("请输入正确的身份证号", "text");
			return;
		}
		_data["realname"] = realname;
		_data["idnumber"] = idnumber;
		var opts = {
			url: _url + "/money/user/auth",
			type: "post",
			load: true,
			data: _data,
			success: function(rs) {
				if(isReqSucceed(rs)) {
					$.alert("实名认证成功", function() {
						window.location.href = "personal-data.html";
					});
				}
			}
		}
		AjaxRequest(opts);
	},
	"loadEvents": function() {
		_pInfo.userInfo = _user.getUserInfo();
	},
	"load": function() {
		this.loadEvents();
		//this.renderData();
	}
}
exposeGlobalMethods({
	"doUserAuth": function() {
		_pInfo.doUserAuth();
	},
});
$(function() {
	_pInfo.load();
});